// components/popup/payment/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    title: {
      type: String,
      value: '选择配送时间'
    },
    activeDay: {
      type: String,
      value: ''
    },
    activeTime: {
      type: String,
      value: ''
    },
    timeData:{
      type:Array,
      value:[]
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    displaydate:''
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 关闭
    onClose () {
      this.triggerEvent('close')
    },
    switchDate(event){
      console.log(event.currentTarget.dataset);
      this.setData({
        displaydate: event.currentTarget.dataset.displaydate,
        activeDay: event.currentTarget.dataset.value,
      });
    },
    switchTime(event){
      this.setData({
        activeTime: event.currentTarget.dataset.value
      });
    },
    confirm(event) {
      this.setData({
        show: false,
      });
      this.triggerEvent('confirm', {
        displaydate:this.data.displaydate,
        day:this.data.activeDay,
        time:this.data.activeTime
      })
    }
  }
});
